package com.naire.modul.answer.service;

import net.common.manager.SystemCodeManager;
import net.common.service.GeneralService;
import com.naire.modul.answer.dao.AnswerDao;
import com.naire.modul.answer.dao.impl.AnswerDaoImpl;
import com.naire.modul.answer.vo.AnswerVo;

/**
 * 
 * 
 * @author Administrator
 * 
 */
public class AnswerEditorService extends GeneralService {

	private AnswerVo bean;
	private String parent_code;

	@Override
	public void execute() throws Exception {
		AnswerDao dao = new AnswerDaoImpl();
		if (bean.getAnswer_id() != null) {
			dao.update(bean);
		} else {
			bean.setFlag(0);
			bean.setSort_num(parent_code);
			bean.setAnswer_num(SystemCodeManager.createCode("0009"));
			dao.insert(bean);
		}
	}

	public void setBean(AnswerVo bean) {
		this.bean = bean;
	}

	public void setParent_code(String parent_code) {
		this.parent_code = parent_code;
	}

}
